var totalTime=0;
function start(){
    setInterval("countdown()",1000);
}
function setTime(time){
    totalTime=time;
}
function getRemainedTime(){
    return totalTime;
}
function getRemainTimeAsString(){
    var hour=parseInt(totalTime/3600);
    var min=parseInt((totalTime-hour*3600)/60);
    var sec=parseInt(totalTime-hour*3600)%60;
    return hour+":"+min+":"+sec;
}
function countdown(){   
   
    if(totalTime>0)
    {
        totalTime--;
        setTimeValueForLabel();   
        return true;
    }else{
      //  document.forms[0].submit();
    document.exam.submit();
     return false;
    }
   
   
}
function setTimeValueForLabel(){
    document.getElementById('time-value').value=getRemainTimeAsString();
}


